package com.third.configuration;

import com.third.interceptor.PermsInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class InterceptorConfiguration implements WebMvcConfigurer {

    @Resource
    private PermsInterceptor interceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        //注册自己的拦截器,并指定拦截那些请求,此处是拦截所有请求
        registry.addInterceptor(interceptor).addPathPatterns("/**");


    }
}
